package com.ghpt.controller;
import com.ghpt.pojo.ShuiDian;
import com.ghpt.service.ShuiDianService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@RestController
@RequestMapping("/shuidian")
public class ShuiDianController {
    private final ShuiDianService shuiDianService;

    public ShuiDianController(ShuiDianService shuiDianService) {
        this.shuiDianService = shuiDianService;
    }
    @GetMapping("/{id}")
    public ShuiDian getShuiDianById(@PathVariable Long id) {
        System.out.println("结果是"+shuiDianService.findShuiDianById(id));
        return shuiDianService.findShuiDianById(id);
    }
    @PutMapping
    public int updateShuiDian(@RequestBody ShuiDian shuiDian) {
        return shuiDianService.updateById(shuiDian);
    }
}
